﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace SmoLiteApi
{
    /// <summary/>
    public class ForeignKeyColumnCollection : IEnumerable<ForeignKeyColumn>
    {
        private List<ForeignKeyColumn> _foreignKeyColumns;

        /// <summary/>
        internal ForeignKeyColumnCollection()
        {
            this._foreignKeyColumns = new List<ForeignKeyColumn>();
        }

        /// <summary/>
        public void Add(ForeignKeyColumn foreignKeyColumn)
        {
            this._foreignKeyColumns.Add(foreignKeyColumn);
        }

        /// <summary/>
        public ForeignKeyColumn this[string name]
        {
            get { return this._foreignKeyColumns.Find(value => value.Name == name); }
        }

        /// <summary/>
        public IEnumerator<ForeignKeyColumn> GetEnumerator()
        {
            return this._foreignKeyColumns.GetEnumerator();
        }

        /// <summary/>
        IEnumerator IEnumerable.GetEnumerator()
        {
            return this._foreignKeyColumns.GetEnumerator();
        }
    }
}
